<?php
namespace App\Api\Movie;

use PhalApi\Api;
use App\Domain\Movie\Banner as BannerDomain;
/**
 * Banner接口
 */
class Banner extends Api
{
    public function getRules()
    {
        return array(
            'getList' => array(
            ),
            'searchList' => array(
                'domain'=>array('name'=>'domain','require'=>false),
            ),
            'getBannerList' => array(
            ),
            'update' => array(
                'id' => array('name' => 'id', 'require' => false),
                'pic'=>array('name'=> 'pic','require'=>true),
                'domain'=>array('name'=> 'domain','require'=>true),
            ),
            'delete'=> array(
                'id'=> array('name'=>'id','require'=>true)
            ),
            'getInfo'=> array(
                'id'=> array('name'=>'id','require'=>true)
            )
        );
    }
    /**
     * 获取Banner列表
     * @desc 用于后端获取Banner列表
     */
    public function getList() {
        $domain = new BannerDomain();
        $res = $domain->getList();
        return $res;
    }
    /**
     * 搜索Banner列表
     * @desc 用于后端搜索Banner列表
     */
    public function searchList() {
        $domain = new BannerDomain();
        $res = $domain->searchList($this->domain);
        return $res;
    }
    /**
     * 更新或添加Banner
     * @desc 有id则是更新无id则是添加
     */
    public function update() {
        $domain = new BannerDomain();
        $data=array(
            'pic'=>$this->pic,
            'domain'=>$this->domain,
            'update_time'=>date('Y-m-d H:i:s',time())
        );
        $res = $domain->update($this->id,$data);
        return $res;
    }
    /**
     * 删除Banner
     * @desc 删除Banner
     */
    public function delete() {
        $domain = new BannerDomain();
        $res = $domain->delete($this->id);
        return array($res);
    }
    /**
     * 获取Banner
     * @desc 获取Banner信息
     */
    public function getInfo() {
        $domain = new BannerDomain();
        $res = $domain->get($this->id);
        return $res;
    }
    /**
     * 用于web端Banner列表
     * @desc 用于web端获取Banner列表
     */
    public function getBannerList() {
        $domain = new BannerDomain();
        $res = $domain->getBannerList();
        return $res;
    }

}
